package com.gzc.just.play.last.war.robotclient;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 机器人客户端属性配置
 * 基于C++配置实现
 */
@Component
@ConfigurationProperties(prefix = "robot.client")
public class RobotClientProperties {
    
    /**
     * 是否启用机器人客户端
     */
    private boolean enabled = false;
    
    /**
     * 最大并发机器人数量
     */
    private int maxRobots = 50;
    
    /**
     * 初始机器人数量
     */
    private int initialCount = 0;
    
    /**
     * 初始机器人ID起始值
     */
    private long initialRobotId = 10000;
    
    /**
     * 启动延迟（毫秒），等待其他服务器完全启动
     */
    private int startupDelay = 5000;
    
    /**
     * 心跳间隔（毫秒）
     */
    private long heartbeatInterval = 10000;
    
    /**
     * 重连间隔（毫秒）
     */
    private long reconnectInterval = 5000;
    
    /**
     * 默认登录服务器配置
     */
    private ServerConfig loginServer = new ServerConfig("127.0.0.1", 30001);
    
    /**
     * 默认网关服务器配置
     */
    private ServerConfig gateServer = new ServerConfig("127.0.0.1", 40001);
    
    /**
     * 机器人默认配置
     */
    private RobotDefaultConfig robotDefault = new RobotDefaultConfig();
    
    // Getters and Setters
    public boolean isEnabled() {
        return enabled;
    }
    
    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }
    
    public int getMaxRobots() {
        return maxRobots;
    }
    
    public void setMaxRobots(int maxRobots) {
        this.maxRobots = maxRobots;
    }
    
    public int getInitialCount() {
        return initialCount;
    }
    
    public void setInitialCount(int initialCount) {
        this.initialCount = initialCount;
    }
    
    public long getInitialRobotId() {
        return initialRobotId;
    }
    
    public void setInitialRobotId(long initialRobotId) {
        this.initialRobotId = initialRobotId;
    }
    
    public int getStartupDelay() {
        return startupDelay;
    }
    
    public void setStartupDelay(int startupDelay) {
        this.startupDelay = startupDelay;
    }
    
    public long getHeartbeatInterval() {
        return heartbeatInterval;
    }
    
    public void setHeartbeatInterval(long heartbeatInterval) {
        this.heartbeatInterval = heartbeatInterval;
    }
    
    public long getReconnectInterval() {
        return reconnectInterval;
    }
    
    public void setReconnectInterval(long reconnectInterval) {
        this.reconnectInterval = reconnectInterval;
    }
    
    public ServerConfig getLoginServer() {
        return loginServer;
    }
    
    public void setLoginServer(ServerConfig loginServer) {
        this.loginServer = loginServer;
    }
    
    public ServerConfig getGateServer() {
        return gateServer;
    }
    
    public void setGateServer(ServerConfig gateServer) {
        this.gateServer = gateServer;
    }
    
    public RobotDefaultConfig getRobotDefault() {
        return robotDefault;
    }
    
    public void setRobotDefault(RobotDefaultConfig robotDefault) {
        this.robotDefault = robotDefault;
    }
    
    /**
     * 服务器配置
     */
    public static class ServerConfig {
        private String host = "127.0.0.1";
        private int port = 30001;
        
        public ServerConfig() {
        }
        
        public ServerConfig(String host, int port) {
            this.host = host;
            this.port = port;
        }
        
        // Getters and Setters
        public String getHost() {
            return host;
        }
        
        public void setHost(String host) {
            this.host = host;
        }
        
        public int getPort() {
            return port;
        }
        
        public void setPort(int port) {
            this.port = port;
        }
    }
    
    /**
     * 机器人默认配置
     */
    public static class RobotDefaultConfig {
        private String usernamePrefix = "test_robot";
        private String password = "123456";
        private String nicknamePrefix = "TestRobot";
        private int sex = 1;
        private int headerId = 1;
        private int platformId = 0;
        
        // Getters and Setters
        public String getUsernamePrefix() {
            return usernamePrefix;
        }
        
        public void setUsernamePrefix(String usernamePrefix) {
            this.usernamePrefix = usernamePrefix;
        }
        
        public String getPassword() {
            return password;
        }
        
        public void setPassword(String password) {
            this.password = password;
        }
        
        public String getNicknamePrefix() {
            return nicknamePrefix;
        }
        
        public void setNicknamePrefix(String nicknamePrefix) {
            this.nicknamePrefix = nicknamePrefix;
        }
        
        public int getSex() {
            return sex;
        }
        
        public void setSex(int sex) {
            this.sex = sex;
        }
        
        public int getHeaderId() {
            return headerId;
        }
        
        public void setHeaderId(int headerId) {
            this.headerId = headerId;
        }
        
        public int getPlatformId() {
            return platformId;
        }
        
        public void setPlatformId(int platformId) {
            this.platformId = platformId;
        }
    }
}